package com.cxs.controller;

import com.cxs.service.StudentService;
import com.cxs.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Project: spring-mvc-mybatis-demo
 * @Author: cxs2014501@163.com
 * @Create: 2022/11/11 10:23
 * @Description:
 **/
@RestController
public class HelloController {

    @Autowired
    private StudentService studentService;

    @GetMapping("/hello")
    public ResultVO helloWorld(){
        return ResultVO.builder()
                .code(200)
                .msg("操作成功")
                .data("Hello World!")
                .build();
    }
    @GetMapping("/student/list")
    public ResultVO list(){
        return ResultVO.builder()
                .code(200)
                .msg("操作成功")
                .data(studentService.list())
                .build();
    }
}
